import { createApp } from 'vue'

// import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'

// global css
import './styles/index.less'
import 'vue-cropper/dist/index.css'

import App from './App.vue'
import router from './router'
import store from './store'

const app = createApp(App)
// app.use(ElementPlus)
app.use(router).use(store).mount('#app')

router.beforeEach((to, from, next) => {
  const token = sessionStorage.getItem('token')
  next()
  // if (token) {
  //   if (['/login'].includes(to.path)) {
  //     next('/')
  //   } else {
  //     next()
  //   }
  // } else {
  //   if (['/login'].includes(to.path)) {
  //     next()
  //   } else {
  //     next('/login')
  //   }
  // }
})

export default app
